package(default_visibility = ["//:__subpackages__"])

licenses(["notice"])

cc_library(
    name = "tink_config",
    srcs = ["tink_config.cc"],
    hdrs = ["tink_config.h"],
    include_prefix = "tink/config",
    visibility = ["//visibility:public"],
    deps = [
        "//:config",
        "//:key_manager",
        "//daead:deterministic_aead_config",
        "//hybrid:hybrid_config",
        "//prf:prf_config",
        "//proto:config_cc_proto",
        "//signature:signature_config",
        "//streamingaead:streaming_aead_config",
        "//util:status",
        "@com_google_absl//absl/base:core_headers",
    ],
)

cc_library(
    name = "config_util",
    srcs = ["config_util.cc"],
    hdrs = ["config_util.h"],
    include_prefix = "tink/config",
    deps = [
        "//proto:config_cc_proto",
    ],
)

config_setting(
    name = "only_fips",
    values = {"define": "use_only_fips=on"},
)

cc_library(
    name = "tink_fips",
    srcs = ["tink_fips.cc"],
    hdrs = ["tink_fips.h"],
    include_prefix = "tink/config",
    defines = select({
        "only_fips": ["TINK_USE_ONLY_FIPS"],
        "//conditions:default": [],
    }),
    visibility = ["//visibility:public"],
    deps = [
        "@com_google_absl//absl/base:core_headers",
        "@boringssl//:crypto",
        "//util:status",
    ],
)

# tests

cc_test(
    name = "tink_config_test",
    size = "small",
    srcs = ["tink_config_test.cc"],
    copts = ["-Iexternal/gtest/include"],
    deps = [
        ":tink_config",
        "//:aead",
        "//:config",
        "//:deterministic_aead",
        "//:hybrid_decrypt",
        "//:hybrid_encrypt",
        "//:mac",
        "//:registry",
        "//:streaming_aead",
        "//aead:aes_gcm_key_manager",
        "//util:status",
        "//util:test_matchers",
        "@com_google_googletest//:gtest_main",
    ],
)

cc_test(
    name = "config_util_test",
    size = "small",
    srcs = ["config_util_test.cc"],
    deps = [
        ":config_util",
        "@com_google_googletest//:gtest_main",
    ],
)

cc_test(
    name = "tink_fips_test",
    size = "small",
    srcs = select({
        "only_fips": ["tink_fips_enabled_test.cc"],
        "//conditions:default": ["tink_fips_disabled_test.cc"],
    }),
    tags = [
        "fips",
    ],
    deps = [
        ":tink_fips",
        "//aead:aead_config",
        "//aead:aead_key_templates",
        "//util:status",
        "//util:test_matchers",
        "//util:test_util",
        "@boringssl//:crypto",
        "@com_google_googletest//:gtest_main",
    ],
)
